package com.woniu.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * 日志切面类
 */
@Aspect
@Component
@Slf4j
public class WebLogAspect {


    /**
     * 处理器
     * @return
     */
    @Around("execution(* com.woniu.apiImpl.*.*(..))")
    public Object log(ProceedingJoinPoint point) throws Throwable {
        Object[] args = point.getArgs();
        String name = point.getSignature().getName();
        log.info("进入接口：{},参数：{}",name,args);
        Object result = point.proceed(args);
        log.info("离开接口：{},返回参数：{}",name,result);
        return result;
    }

}
